CAN (Controller Area Network) - Operating principle

The CAN bus is an asynchronous, serial field bus system for networking controllers, sensors and actuators. Unlike other network protocols, CAN does not address the bus nodes (controllers) but the transmitted message. In short: The message contains the information of who has sent it and the bus nodes decide whether they use the message or not. For this purpose, the CAN bus has been designed as a multi-master topology (all nodes have equal access) where the bus access is regulated by the CSMA/CA (Carrier Sense Multiple Access / Collision Avoidance) procedure. Bus access collisions are avoided by using bit-by-bit arbitration. The data are NRZ-L coded. Cyclic redundancy checking via CRC is also in use.

CAN network basics:

CAN is a locally restricted system that belongs to the family of the LAN (Local Area Network) networks. This means that it conforms to the OSI network model.

The OSI network model defines seven layers.

Layer Description  
Application (7) Application layer / Processing layer. The functionality of the network is provided to the user in this layer, e.g. e-mail in the Internet (Ethernet).  
Presentation (6) Presentation layer. The system-dependent data (data in the transmission controller) is changed to a system-independent representation that corresponds to the CAN protocol. This also includes data compression and encryption. In short: Translates the data of the transmission controller into the "CAN language".  
Session (5) Session layer. Communication between the controllers in the vehicle is controlled here.  
Transport (4) Transport layer. It is responsible for segmenting data packages and avoiding data backup on the CAN bus.  
Network (3) Network layer. It is responsible for routing the data packages on the BUS. (The data streams are routed from the sending to the receiving stations. Can be compared to transferring a phone call from one extension to another.)  
Data Link (2) Safety layer. The data is split into bit data streams and provided with checksums here (encoding of the data).  
Physical (1) Bit transfer layer. This is the cabling (copper cable / optical cable).  

CAN transmission systems

The CAN bus in vehicles is used as a linear bus. Ring or star topologies are not allowed. The bus medium is a twisted or shielded two-wire copper line (CAN-H and CAN-L) that is terminated with a 120 Ω resistor. These terminating resistors are mandatory because otherwise the CAN signals could be reflected from an open or wrongly connected line end and return on the same line. These reflections would overlay the signals actually provided on the CAN bus, thus causing the system nodes to become illegible.

CAN

System node It consists of a micro-controller, a CAN controller and a bus driver.
Micro-controller Controls the CAN controller and processes sent and received data.
CAN controller Implements the transmission and receive operations via the CAN bus.
Bus driver Sending or receiving the bus level.
Bus line Two-wire line (twisted or shielded)
Bus termination Resistors to avoid reflections. (mandatory)

CAN

CAN bus level:

The CAN signal is a digital signal (only two conditions "recessive = 1" and "dominant = 0") that is short-circuit proof in a range from -3 V to +32 V for +24 V vehicles. The recessive level has been defined with 2.5 V for both lines, the dominant level with 3.5 V (3 V to 5 V) for CAN-H and 1.5 V (max. 2 V) for CAN-L. The difference between CAN-H and CAN-L is decisive for detecting a change in the condition. The voltage difference between CAN-H and CAN-L has been defined with 2 V (1.6 V - 5 V) for a dominant level and with 0 V (-1 V - 0.5 V) for a recessive level.

CAN

CAN structure of a data protocol:

A complete data package (dataset) on the CAN bus consists of seven fields.

CAN
Start Frame The Start Frame marks the beginning of a message and synchronizes all stations.
Arbitration Field The Arbitration Field consists of a message identifier (11 bits) and one check bit. During transmission of this field, for each bit the sending station checks whether it is still authorized to send, or whether another station with higher priority is sending. The check bit decides whether the message is a data frame or a remote frame.
Check Field The Check Field contains the code for the number of data bytes in the data field.
Data Field The Data Field transmits information for other stations. The information content is between 0 and 8 bytes (1 byte = 8 bits), max. 64 bits.
CRC Field The CRC Field is used to detect transmission faults.
Acknowledgement Field In the Ack Field the recipient signals to the sending station that it has correctly received the message. If a fault is detected, the sending station will be notified immediately. The sender will then resend the data.
End of Frame The End of Frame marks the end of the message. This is the last chance to report faults.

The SAE J1939 CAN protocol also defines another arbitration field from 11 bits (base frame format) - to 19 bits (extended frame format) - identification.

Arbitration Field - object identifier:

The object identifier designates the contents of a message. On the basis of this identifier the recipients decide whether the message is relevant to them or if it is discarded. This identifier is also used for prioritization and arbitration of the messages.

CAN is a multi-master bus system. Arbitration and prioritization regulate the transmission rights to the bus.

Arbitration principle:

The CAN bus load is started by transmitting a dominant bit (SOF). The bits of the identifier are then transmitted to the bus one after another, and compared to the actually provided bus level. If a difference is detected during arbitration (recessive sent - dominant detected), the sender of the recessive level will withdraw from the bus and switch immediately to reception mode. The dominant bus level that was detected was received from a sender with higher priority.